{% extends "./template.html" %}

{% block body %}
<div class="pb-3 pt-3 fixed-top" style="background: #fff;">
    <div class="container">
        <a href="/post?user_id={{user_id}}" class="btn btn-sm btn-primary">发布文章</a>
        <a href="/tags?user_id={{user_id}}" class="ml-2 btn btn-sm btn-success">标签管理</a>
        <a href="/articles?user_id={{user_id}}" class="ml-2 btn btn-sm btn-warning">文章管理</a>
    </div>
</div>
<div class="flex mb-3 pt-5" id="tags-box">
    标签：
    {% for tag in tags %}
    <a href="?user_id={{user_id}}&tag_id={{tag.id}}" class="ml-2 mb-2 btn btn-sm btn-outline-success">{{tag.title}}</a>
    {% endfor %}
</div>
<div id="list-box">
    <ul class="list-group" id="list">
        {% for item in articles %}
        {% if item.title!='' %}
        <li class="list-group-item">
            <a href="/markdown?user_id={{user_id}}&id={{ item.id }}">{{ item.title }}</a>
        </li>
        {% endif %}
        {% endfor %}
    </ul>
</div>
{% endblock %}

{% block script %}
<script type="module">
    window.onload = () => {
        let isLogin = localStorage.getItem('isLogin') ? true : false;
        if (!isLogin) {
            return window.location = '/login'
        }
    }
</script>
{% endblock %}